<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="订单编码" prop="orderCode">
        <el-input
          v-model="queryParams.orderCode"
          placeholder="请输入订单编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="订单类型" prop="orderType">
        <el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable>
          <el-option
            v-for="dict in dict.type.wms_order_audit_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
          <el-option
            v-for="dict in dict.type.wms_order_audit_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="auditOrderList">
      <el-table-column type="index" width="55" label="序号" align="center">
        <template slot-scope="scope">
          {{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}
        </template>
      </el-table-column>
      <el-table-column label="订单编码" align="center" prop="orderCode">
        <template slot-scope="scope">
          <el-link type="primary" @click="handleLook(scope.row)">{{ scope.row.orderCode }}</el-link>
        </template>
      </el-table-column>
      <el-table-column label="审核人" align="center" prop="auditUserName" />
      <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单类型" align="center" prop="orderType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.wms_order_audit_type" :value="scope.row.orderType"/>
        </template>
      </el-table-column>
      <el-table-column label="失败原因" align="center" prop="reason" :show-overflow-tooltip="true"/>
      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.wms_order_audit_status" :value="scope.row.status"/>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-if="scope.row.status === '0'"
            v-hasPermi="['wms:auditOrder:edit']"
          >审核</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改审核管理对话框 -->
    <el-dialog title="审核" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="订单编码" prop="orderCode">
          {{form.orderCode}}
        </el-form-item>
        <el-form-item label="状态">
          <el-radio-group v-model="form.status" @change="handleStatusChange">
            <el-radio
              v-for="dict in auditStatusArr"
              :key="dict.val"
              :label="dict.val"
            >{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="失败原因" prop="reason" v-if="form.status === '1'">
          <el-input
            type="textarea"
            :rows="2"
            placeholder="请输入失败原因"
            v-model="form.reason">
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm" v-loading="btnLoading">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（比价单）" custom-class="bjDetail" :visible.sync="openComparisonLook" fullscreen append-to-body>
      <comparison-product-detail :gl-order-code="glOrderCode" :audit-id="auditId" :open-flag="openComparisonLook"/>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（合同）" custom-class="bjDetail" :visible.sync="openContractLook" width="80%" append-to-body>
      <el-form>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="合同金额">
              {{contractInfo.contractPrice}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="内容数量">
              {{contractInfo.productNum}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="厂家交货期">
              {{contractInfo.cjJhValid}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报价交货期">
              {{contractInfo.jhValid}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="付款方式">
          <dict-tag :options="dict.type.wms_pay_type" :value="contractInfo.payType"/>
        </el-form-item>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="是否物流">
              <dict-tag :options="dict.type.sys_yes_no" :value="contractInfo.ifLogistics"/>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="contractInfo.ifLogistics === 'Y'">
            <el-form-item label="物流方式">
              <dict-tag :options="dict.type.wms_logistics" :value="contractInfo.logisticsModule"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="contractInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="先款比例">
              {{contractInfo.prefixPayRate}} 备注：{{contractInfo.prefixRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="进度款比例">
              {{contractInfo.processPayRate}} 备注：{{contractInfo.processRemark}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="contractInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="尾款比例">
              {{contractInfo.tailPayRate}} 备注：{{contractInfo.tailRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="尾款支付时间">
              货到后{{contractInfo.tailPayTime}}天付款
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="支付金额">
              {{contractInfo.payPrice}}
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="合同附件" v-if="contractInfo.fileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="contractInfo.fileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="支付附件" v-if="contractInfo.payFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="contractInfo.payFileList">
          </el-upload>
        </el-form-item>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="contractInfo.orderProductTable">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="交货期（买家）">
                    <span>{{ props.row.delivery }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="modal" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（采购单）" custom-class="bjDetail" :visible.sync="openPurchaseLook" width="80%" append-to-body>
      <el-form>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="采购金额">
              {{purchaseInfo.purchasePrice}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="内容数量">
              {{purchaseInfo.productNum}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="付款方式">
          <dict-tag :options="dict.type.wms_pay_type" :value="purchaseInfo.payType"/>
        </el-form-item>
        <el-row :gutter="10" v-if="purchaseInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="先款比例">
              {{purchaseInfo.prefixPayRate}} 备注：{{purchaseInfo.prefixRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="进度款比例">
              {{purchaseInfo.processPayRate}} 备注：{{purchaseInfo.processRemark}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="purchaseInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="尾款比例">
              {{purchaseInfo.tailPayRate}} 备注：{{purchaseInfo.tailRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="尾款支付时间">
              货到后{{purchaseInfo.tailPayTime}}天付款
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="支付金额">
              {{purchaseInfo.payPrice}}
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="合同附件" v-if="purchaseInfo.fileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="purchaseInfo.fileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="支付附件" v-if="purchaseInfo.payFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="purchaseInfo.payFileList">
          </el-upload>
        </el-form-item>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="purchaseInfo.orderProductTable">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="交货期（厂家）">
                    <span>{{ props.row.manufacturerDelivery }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="交货期（买家）">
                    <span>{{ props.row.delivery }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="modal" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（物流单）" custom-class="bjDetail" :visible.sync="openLogisticsLook" width="80%" append-to-body>
      <el-form>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="运费金额">
              {{logisticsInfo.logisticsPrice}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="内容数量">
              {{logisticsInfo.productNum}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="物流方式">
              <dict-tag :options="dict.type.wms_logistics" :value="logisticsInfo.payType"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="物流条款">
              {{logisticsInfo.logisticsTerms}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="收货人">
              {{logisticsInfo.consigneeIdStr}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="货运单号">
              {{logisticsInfo.logisticsNo}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="发货城市">
              {{logisticsInfo.sendName}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发货地址">
              {{logisticsInfo.sendAddress}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="收货城市">
              {{logisticsInfo.deliveryName}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收货地址">
              {{logisticsInfo.deliveryAddress}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="箱体编号">
              {{logisticsInfo.boxCode}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预计到货日期">
              {{logisticsInfo.goodsArrivedTime}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-form-item label="清关">
            <dict-tag :options="dict.type.sys_yes_no" :value="logisticsInfo.isQg"/>
          </el-form-item>
          <el-col :span="12" v-if="logisticsInfo.isQg == 'Y'">
            <el-form-item label="清关公司">
              {{logisticsInfo.qgEntName}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="付款方式">
              <dict-tag :options="dict.type.wms_pay_type" :value="logisticsInfo.payType"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="logisticsInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="先款比例">
              {{logisticsInfo.prefixPayRate}} 备注：{{logisticsInfo.prefixRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="进度款比例">
              {{logisticsInfo.processPayRate}} 备注：{{logisticsInfo.processRemark}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="logisticsInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="尾款比例">
              {{logisticsInfo.tailPayRate}} 备注：{{logisticsInfo.tailRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="尾款支付时间">
              货到后{{logisticsInfo.tailPayTime}}天付款
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="支付金额">
              {{logisticsInfo.payPrice}}
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="箱体照片" v-if="logisticsInfo.fileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            list-type="picture"
            :file-list="logisticsInfo.fileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="合同附件" v-if="logisticsInfo.contractFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="logisticsInfo.contractFileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="支付附件" v-if="logisticsInfo.payFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="logisticsInfo.payFileList">
          </el-upload>
        </el-form-item>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="logisticsInfo.orderProductTable">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :span="12">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="交货期（厂家）">
                    <span>{{ props.row.manufacturerDelivery }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="交货期（买家）">
                    <span>{{ props.row.delivery }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="modal" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（确认收货）" custom-class="bjDetail" :visible.sync="openConfirmLogisticsLook" width="80%" append-to-body>
      <el-form>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="运费金额">
              {{logisticsInfo.logisticsPrice}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="内容数量">
              {{logisticsInfo.productNum}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="物流方式">
              <dict-tag :options="dict.type.wms_logistics" :value="logisticsInfo.logisticsModule"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="物流条款">
              {{logisticsInfo.logisticsTerms}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="收货人">
              {{logisticsInfo.consigneeIdStr}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="货运单号">
              {{logisticsInfo.logisticsNo}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="发货城市">
              {{logisticsInfo.sendName}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发货地址">
              {{logisticsInfo.sendAddress}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="收货城市">
              {{logisticsInfo.deliveryName}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收货地址">
              {{logisticsInfo.deliveryAddress}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="箱体编号">
              {{logisticsInfo.boxCode}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预计到货日期">
              {{logisticsInfo.goodsArrivedTime}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="付款方式">
              <dict-tag :options="dict.type.wms_pay_type" :value="logisticsInfo.payType"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="logisticsInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="先款比例">
              {{logisticsInfo.prefixPayRate}} 备注：{{logisticsInfo.prefixRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="进度款比例">
              {{logisticsInfo.processPayRate}} 备注：{{logisticsInfo.processRemark}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="logisticsInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="尾款比例">
              {{logisticsInfo.tailPayRate}} 备注：{{logisticsInfo.tailRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="尾款支付时间">
              货到后{{logisticsInfo.tailPayTime}}天付款
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="支付金额">
              {{logisticsInfo.payPrice}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本次支付金额">
              {{logisticsInfo.payPrice2}}
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="货到附件" v-if="logisticsInfo.fileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            list-type="picture"
            :file-list="logisticsInfo.fileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="支付附件" v-if="logisticsInfo.payFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="logisticsInfo.payFileList">
          </el-upload>
        </el-form-item>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="logisticsInfo.orderProductTable">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :span="12">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="交货期（厂家）">
                    <span>{{ props.row.manufacturerDelivery }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="交货期（买家）">
                    <span>{{ props.row.delivery }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="modal" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（清关单）" custom-class="bjDetail" :visible.sync="openCustomsClearanceLook" width="80%" append-to-body>
      <el-form>
        <el-form-item label="负责人">
          {{customsClearanceInfo.headStr}}
        </el-form-item>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="清关公司">
              {{customsClearanceInfo.qgEntName}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预计清关时间">
              {{customsClearanceInfo.endTime}}
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="清关附件" v-if="customsClearanceInfo.fileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="customsClearanceInfo.fileList">
          </el-upload>
        </el-form-item>

        <el-form-item label="清关完成附件" v-if="customsClearanceInfo.successFileList.length > 0">
          <el-upload
            action=""
            class="upload-demo"
            :disabled="true"
            :on-preview="handlePreview"
            :file-list="customsClearanceInfo.successFileList">
          </el-upload>
        </el-form-item>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="customsClearanceInfo.orderProductTable">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="交货期（厂家）">
                    <span>{{ props.row.manufacturerDelivery }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="交货期（买家）">
                    <span>{{ props.row.delivery }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>

    <!-- 审核详情对话框 -->
    <el-dialog title="审核详情（报价单修改）" custom-class="bjDetail" :visible.sync="openReportOfferLook" width="80%" append-to-body>
      <el-form>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="报价单编码" prop="orderCode">
              {{form.orderCode}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否物流" prop="ifLogistics">
              <dict-tag :options="dict.type.sys_yes_no" :value="reportOfferInfo.ifLogistics"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10"  v-if="reportOfferInfo.ifLogistics === 'Y'">
          <el-col :span="12">
            <el-form-item label="物流条款" prop="logisticsTermsId">
              {{reportOfferInfo.logisticsTerms}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="物流方式">
              <dict-tag :options="dict.type.wms_logistics" :value="reportOfferInfo.logisticsModule"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10"  v-if="reportOfferInfo.ifLogistics === 'Y'">
          <el-col :span="12">
            <el-form-item label="运费">
              {{reportOfferInfo.freight}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="保险费">
              {{reportOfferInfo.safe}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="杂费">
              {{reportOfferInfo.ext}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单总额">
              {{reportOfferInfo.allPrice}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="报价交货期">
              {{reportOfferInfo.jhValid}}天
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="厂家交货期">
              <span v-if="reportOfferInfo.cjJhValid">{{reportOfferInfo.cjJhValid}}天</span>
              <span v-else>无</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="支付方式">
              <dict-tag :options="dict.type.wms_pay_type" :value="reportOfferInfo.payType"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="reportOfferInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="先款比例">
              {{reportOfferInfo.prefixPayRate}} 备注：{{reportOfferInfo.prefixRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="进度款比例">
              {{reportOfferInfo.processPayRate}} 备注：{{reportOfferInfo.processRemark}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10" v-if="reportOfferInfo.payType === '1'">
          <el-col :span="12">
            <el-form-item label="尾款比例">
              {{reportOfferInfo.tailPayRate}} 备注：{{reportOfferInfo.tailRemark}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item>
              <template slot="label">
                尾款支付时间
              </template>
              货到{{reportOfferInfo.tailPayTime}}天后付款
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="利润比例">
              {{reportOfferInfo.ratio}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报价有效期">
              {{reportOfferInfo.valid}}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <h1>商品信息</h1>
      <el-table :data="reportOfferInfo.products">
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="商品编码">
                    <span>{{ props.row.productCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="商品类型">
                    <span>{{ props.row.productTypeName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="计数单位">
                    <span>{{ props.row.unitName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="尺寸单位">
                    <span>{{ props.row.ccUnitName }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="尺寸">
                    <span v-if="props.row.longWith || props.row.weight || props.row.height">{{ props.row.longWith + '*' + props.row.weight + '*' + props.row.height }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="重量">
                    <span>{{ props.row.zl }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="详情">
                <span>{{ props.row.detail }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="商品名称" align="center" prop="productName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品型号" align="center" prop="modal" :show-overflow-tooltip="true"/>
        <el-table-column label="生产厂家" align="center" prop="scPurchaseCompanyName" :show-overflow-tooltip="true"/>
        <el-table-column label="商品数量" align="center" prop="productNum"/>
        <el-table-column label="成本" align="center" prop="oldOnlyPrice"/>
        <el-table-column label="单价" align="center" prop="onlyPrice"/>
        <el-table-column label="总价" align="center" prop="allPrice"/>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  listAuditOrder,
  updateAuditOrder,
  getContractAuditInfo,
  getPurchaseAuditInfo,
  getLogisticsAuditInfo, getCustomsClearanceAuditInfo, getOfferReportAuditInfo, getLogisticsConfirmAuditInfo
} from '@/api/wms/auditOrder'
import comparisonProductDetail from "@/views/wms/auditOrder/compoents/comparisonProductDetail.vue";
import {logisticsUserListXlk} from "@/api/system/user";

export default {
  name: "AuditOrder",
  dicts: ['wms_order_audit_status','wms_order_audit_type','wms_order_product_status', 'wms_pay_type', 'wms_logistics', 'sys_yes_no'],
  components: {comparisonProductDetail},
  data() {
    return {
      prefix: process.env.VUE_APP_BASE_API,
      //按钮加载
      btnLoading: false,
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      auditStatusArr: [
        {
          val: '2',
          label: '审核通过'
        },
        {
          val: '1',
          label: '审核拒绝'
        }
      ],
      // 总条数
      total: 0,
      // 审核管理表格数据
      auditOrderList: [],
      // 是否显示弹出层
      open: false,
      // 审核详情(比价单)
      openComparisonLook: false,
      // 审核详情(合同)
      openContractLook: false,
      // 审核详情(采购单)
      openPurchaseLook: false,
      // 审核详情(物流单)
      openLogisticsLook: false,
      // 审核详情(确认收货)
      openConfirmLogisticsLook: false,
      // 审核详情(清关单)
      openCustomsClearanceLook: false,
      // 审核详情(报价单已报价)
      openReportOfferLook: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderCode: null,
        status: null,
        orderType: null
      },
      comparisonDetail: null,
      auditId: null,
      glOrderCode: null,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        reason: [
          { max: 255, message: '失败原因长度最多 255个字', trigger: 'blur' }
        ]
      },
      contractInfo:{
        productNum: null,
        logisticsModule: '',
        ifLogistics: '',
        payType: '',
        contractPrice: '',
        prefixPayRate: '',
        prefixRemark: '',
        processPayRate: '',
        processRemark: '',
        tailPayRate: '',
        tailRemark: '',
        tailPayTime: '',
        payPrice: '',
        jhValid: null,
        cjJhValid: null,
        orderProductTable:[],
        fileList:[],
        payFileList:[],
      },
      purchaseInfo:{
        productNum: null,
        payType: '',
        purchasePrice: '',
        prefixPayRate: '',
        processPayRate: '',
        tailPayRate: '',
        tailPayTime: '',
        payPrice: '',
        orderProductTable:[],
        fileList:[],
        payFileList:[],
      },
      logisticsInfo:{
        productNum: null,
        payType: '',
        logisticsPrice: '',
        prefixPayRate: '',
        processPayRate: '',
        tailPayRate: '',
        tailPayTime: '',
        boxCode: '',
        logisticsNo: null,
        logisticsModule: null,
        goodsArrivedTime: null,
        consigneeIdStr: null,
        sendAddress: null,
        sendName: null,
        deliveryAddress: null,
        deliveryName: null,
        logisticsTerms: null,
        qgEntName: null,
        payPrice: null,
        payPrice2: null,
        isQg: null,
        orderProductTable:[],
        fileList:[],
        payFileList:[],
        contractFileList:[],
      },
      customsClearanceInfo:{
        headStr: null,
        qgEntName: null,
        endTime: null,
        orderProductTable:[],
        fileList:[],
        successFileList:[],
      },
      reportOfferInfo:{
        orderCode: null,
        inquireCode: null,
        priceComparisonCode: null,
        offerTime: null,
        logisticsTermsId: null,
        logisticsTerms: null,
        logisticsModule: null,
        ifLogistics: null,
        ratio: null,
        freight: null,
        safe: null,
        ext: null,
        jhValid: null,
        allPrice: null,
        prefixPayRate: 0,
        processPayRate: 0,
        tailPayRate: 0,
        tailPayTime: 0,
        payType: null,
        products: []
      },
      // 联系人集合
      userList: []
    };
  },
  created() {
    this.getList();
    this.getLogisticsUserList();
  },
  methods: {
    /** 查询审核管理列表 */
    getList() {
      this.loading = true;
      listAuditOrder(this.queryParams).then(response => {
        this.auditOrderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询联系人下拉框 */
    getLogisticsUserList() {
      logisticsUserListXlk().then(response => {
        this.userList = response.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        status: '2',
        reason: null,
        orderCode: null,
        orderType: null,
        glOrderCode: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 审核按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.form.orderCode = row.orderCode;
      this.form.glOrderCode = row.glOrderCode;
      this.form.orderType = row.orderType;
      this.form.inquireCode = row.inquireCode;
      this.form.createUser = row.createUser;
      this.form.id = row.id;
      this.open = true;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.btnLoading = true
          updateAuditOrder(this.form).then(response => {
            this.$modal.msgSuccess("审核成功");
            this.open = false;
            this.getList();
          }).finally(f => {
            this.btnLoading = false
          });
        }
      });
    },
    restForm(){
      this.contractInfo = {
        productNum: null,
        logisticsModule: '',
        ifLogistics: '',
        payType: '',
        contractPrice: '',
        prefixPayRate: '',
        prefixRemark: '',
        processPayRate: '',
        processRemark: '',
        tailPayRate: '',
        tailRemark: '',
        tailPayTime: '',
        payPrice: '',
        jhValid: null,
        cjJhValid: null,
        orderProductTable:[],
        fileList:[],
        payFileList:[],
      }
      this.purchaseInfo = {
        productNum: null,
        payType: '',
        purchasePrice: '',
        prefixPayRate: '',
        processPayRate: '',
        tailPayRate: '',
        tailPayTime: '',
        payPrice: '',
        orderProductTable:[],
        fileList:[],
        payFileList:[],
      }
      this.logisticsInfo = {
        productNum: null,
        payType: '',
        logisticsPrice: '',
        prefixPayRate: '',
        processPayRate: '',
        tailPayRate: '',
        tailPayTime: '',
        boxCode: '',
        logisticsNo: null,
        logisticsModule: null,
        goodsArrivedTime: null,
        consigneeIdStr: null,
        sendAddress: null,
        sendName: null,
        deliveryAddress: null,
        deliveryName: null,
        logisticsTerms: null,
        qgEntName: null,
        payPrice: null,
        orderProductTable:[],
        fileList:[],
        payFileList:[],
        contractFileList:[],
      }
      this.reportOfferInfo = {
        orderCode: null,
        orderProductTable:[],
        fileList:[]
      }
    },
    // 查看订单详情
    handleLook(row){
      this.restForm()
      this.auditId = row.id
      switch (row.orderType) {
        case '0':
          this.glOrderCode = row.glOrderCode;
          this.openComparisonLook = true
          break
        case '1':
          // 合同
          getContractAuditInfo({orderCode: row.orderCode}).then(response => {
            let data = response.data;
            this.contractInfo.logisticsModule = data.logisticsModule
            this.contractInfo.ifLogistics = data.ifLogistics
            this.contractInfo.payType = data.payType
            this.contractInfo.contractPrice = data.contractPrice
            this.contractInfo.prefixPayRate = data.prefixPayRate
            this.contractInfo.processPayRate = data.processPayRate
            this.contractInfo.tailPayRate = data.tailPayRate
            this.contractInfo.tailPayTime = data.tailPayTime
            this.contractInfo.productNum = data.productNum
            this.contractInfo.prefixRemark = data.prefixRemark
            this.contractInfo.processRemark = data.processRemark
            this.contractInfo.tailRemark = data.tailRemark
            this.contractInfo.jhValid = data.jhValid
            this.contractInfo.cjJhValid = data.cjJhValid
            this.contractInfo.payPrice = data.payPrice
            this.contractInfo.orderProductTable = data.products
            let accessoryList = data.accessoryList
            let payAccessoryList = data.payAccessoryList

            if (accessoryList && accessoryList.length > 0) {
              accessoryList.forEach(item => {
                let urls = item.split("/")
                this.contractInfo.fileList.push({name: urls[urls.length - 1], url: this.prefix + item})
              })
            }
            if (payAccessoryList && payAccessoryList.length > 0) {
              payAccessoryList.forEach(item => {
                let urls = item.split("/")
                this.contractInfo.payFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
              })
            }
            this.openContractLook = true
          })
          break
        case '2':
          // 采购单
          getPurchaseAuditInfo({orderCode: row.orderCode}).then(response => {
            let data = response.data;
            this.purchaseInfo.payType = data.payType
            this.purchaseInfo.purchasePrice = data.purchasePrice
            this.purchaseInfo.prefixPayRate = data.prefixPayRate
            this.purchaseInfo.prefixRemark = data.prefixRemark
            this.purchaseInfo.processPayRate = data.processPayRate
            this.purchaseInfo.processRemark = data.processRemark
            this.purchaseInfo.tailPayRate = data.tailPayRate
            this.purchaseInfo.tailRemark = data.tailRemark
            this.purchaseInfo.tailPayTime = data.tailPayTime
            this.purchaseInfo.payPrice = data.payPrice
            this.purchaseInfo.productNum = data.productNum
            this.purchaseInfo.orderProductTable = data.products
            let accessoryList = data.accessoryList
            let payAccessoryList = data.payAccessoryList

            if (accessoryList && accessoryList.length > 0) {
              accessoryList.forEach(item => {
                let urls = item.split("/")
                this.purchaseInfo.fileList.push({name: urls[urls.length - 1], url: this.prefix + item})
              })
            }
            if (payAccessoryList && payAccessoryList.length > 0) {
              payAccessoryList.forEach(item => {
                let urls = item.split("/")
                this.purchaseInfo.payFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
              })
            }
            this.openPurchaseLook = true
          })
          break
        case '3':
          // 物流单
          this.handleSelectLogisticsInfo(row.orderCode)
          break
        case '5':
          // 物流单(新增)
          this.handleSelectLogisticsInfo(row.orderCode)
          break
        case '4':
          // 清关单
          this.getCustomsClearanceAuditInfo(row.orderCode)
          break
        case '6':
          // 清关完成
          this.getCustomsClearanceAuditInfo(row.orderCode)
          break
        case '12':
          // 报价修改
          getOfferReportAuditInfo({orderCode: row.orderCode, glOrderCode: row.glOrderCode}).then(response => {
            this.reportOfferInfo = response.data;
            this.openReportOfferLook = true
          })
          break
        case '13':
          // 确认收货
          this.handleSelectConfirmLogisticsInfo(row.orderCode)
          break
      }
    },
    handleSelectLogisticsInfo(orderCode) {
      getLogisticsAuditInfo({orderCode: orderCode}).then(response => {
        let data = response.data;
        this.logisticsInfo.productNum = data.productNum
        this.logisticsInfo.payType = data.payType
        this.logisticsInfo.logisticsPrice = data.logisticsPrice
        this.logisticsInfo.purchasePrice = data.purchasePrice
        this.logisticsInfo.prefixPayRate = data.prefixPayRate
        this.logisticsInfo.prefixRemark = data.prefixRemark
        this.logisticsInfo.processPayRate = data.processPayRate
        this.logisticsInfo.processRemark = data.processRemark
        this.logisticsInfo.tailPayRate = data.tailPayRate
        this.logisticsInfo.tailRemark = data.tailRemark
        this.logisticsInfo.tailPayTime = data.tailPayTime
        this.logisticsInfo.boxCode = data.boxCode
        this.logisticsInfo.logisticsNo = data.logisticsNo
        this.logisticsInfo.goodsArrivedTime = data.goodsArrivedTime
        this.logisticsInfo.logisticsModule = data.logisticsModule
        this.logisticsInfo.sendName = data.sendName
        this.logisticsInfo.sendAddress = data.sendAddress
        this.logisticsInfo.deliveryAddress = data.deliveryAddress
        this.logisticsInfo.deliveryName = data.deliveryName
        this.logisticsInfo.logisticsTerms = data.logisticsTerms
        this.logisticsInfo.qgEntName = data.qgEntName
        this.logisticsInfo.consigneeIdStr = data.consigneeStr
        this.logisticsInfo.payPrice = data.payPrice
        this.logisticsInfo.isQg = data.isQg

        this.logisticsInfo.orderProductTable = data.products
        let accessoryList = data.accessoryList
        let payAccessoryList = data.payAccessoryList
        let contractAccessoryList = data.contractAccessoryList

        if (accessoryList && accessoryList.length > 0) {
          accessoryList.forEach(item => {
            let urls = item.split("/")
            this.logisticsInfo.fileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        if (payAccessoryList && payAccessoryList.length > 0) {
          payAccessoryList.forEach(item => {
            let urls = item.split("/")
            this.logisticsInfo.payFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        if (contractAccessoryList && contractAccessoryList.length > 0) {
          contractAccessoryList.forEach(item => {
            let urls = item.split("/")
            this.logisticsInfo.contractFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        this.openLogisticsLook = true
      })
    },
    handleSelectConfirmLogisticsInfo(orderCode) {
      getLogisticsConfirmAuditInfo({orderCode: orderCode}).then(response => {
        let data = response.data;
        this.logisticsInfo.productNum = data.productNum
        this.logisticsInfo.payType = data.payType
        this.logisticsInfo.logisticsPrice = data.logisticsPrice
        this.logisticsInfo.processPayRate = data.processPayRate
        this.logisticsInfo.processRemark = data.processRemark
        this.logisticsInfo.tailPayRate = data.tailPayRate
        this.logisticsInfo.tailRemark = data.tailRemark
        this.logisticsInfo.tailPayTime = data.tailPayTime
        this.logisticsInfo.boxCode = data.boxCode
        this.logisticsInfo.logisticsNo = data.logisticsNo
        this.logisticsInfo.goodsArrivedTime = data.goodsArrivedTime
        this.logisticsInfo.logisticsModule = data.logisticsModule
        this.logisticsInfo.sendName = data.sendName
        this.logisticsInfo.sendAddress = data.sendAddress
        this.logisticsInfo.deliveryAddress = data.deliveryAddress
        this.logisticsInfo.deliveryName = data.deliveryName
        this.logisticsInfo.logisticsTerms = data.logisticsTerms
        this.logisticsInfo.qgEntName = data.qgEntName
        this.logisticsInfo.consigneeIdStr = data.consigneeStr
        this.logisticsInfo.payPrice = data.payPrice
        this.logisticsInfo.payPrice2 = data.payPrice2
        this.logisticsInfo.isQg = data.isQg

        this.logisticsInfo.orderProductTable = data.products
        let accessoryList = data.accessoryList
        let payAccessoryList = data.payAccessoryList

        if (accessoryList && accessoryList.length > 0) {
          accessoryList.forEach(item => {
            let urls = item.split("/")
            this.logisticsInfo.fileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        if (payAccessoryList && payAccessoryList.length > 0) {
          payAccessoryList.forEach(item => {
            let urls = item.split("/")
            this.logisticsInfo.payFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        this.openConfirmLogisticsLook = true
      })
    },
    getCustomsClearanceAuditInfo(orderCode) {
      getCustomsClearanceAuditInfo({orderCode: orderCode}).then(response => {
        let data = response.data;
        this.customsClearanceInfo.qgEntName = data.qgEntName
        this.customsClearanceInfo.endTime = data.endTime
        this.customsClearanceInfo.headStr = data.headStr

        this.customsClearanceInfo.orderProductTable = data.products
        let accessoryList = data.accessoryList
        let successAccessoryList = data.successAccessoryList

        if (accessoryList && accessoryList.length > 0) {
          accessoryList.forEach(item => {
            let urls = item.split("/")
            this.customsClearanceInfo.fileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        if (successAccessoryList && successAccessoryList.length > 0) {
          successAccessoryList.forEach(item => {
            let urls = item.split("/")
            this.customsClearanceInfo.successFileList.push({name: urls[urls.length - 1], url: this.prefix + item})
          })
        }
        this.openCustomsClearanceLook = true
      })
    },
    // 状态变更事件
    handleStatusChange(val){
      if (val === '1') {
        this.rules.reason = [
          { required: true, message: "失败原因不能为空", trigger: "blur" },
          { max: 255, message: '失败原因长度最多 255个字', trigger: 'blur' }
        ]
      } else {
        this.rules.reason = [
          { max: 255, message: '失败原因长度最多 255个字', trigger: 'blur' }
        ]
      }
    },
    // 文件点击事件
    handlePreview(file){
      window.open(file.url,'_blank');
    },
  }
};
</script>
<style scoped>
/deep/ .bjDetail .el-dialog__body{
  height: 100%;
  overflow-y: auto;
}
</style>
